<html>
	<head>
		<title>Test Upload Progress</title>
		<script type="text/javascript" src="LoadVars.js"><!--// http://www.devpro.it/javascript_id_92.html //--></script>
		<script type="text/javascript" src="BytesUploaded.js"><!--// http://www.devpro.it/javascript_id_96.html //--></script>
		<script type="text/javascript">
			var bUploaded = new BytesUploaded('whileuploading.php');
		</script>
	</head>
	<body style="font-family: sans-serif; font-size: 8pt;">
		<form enctype="multipart/form-data" method="post" action="index.php" onsubmit="bUploaded.start('fileprogress');">
			<div>
				<fieldset style="padding: 20px;">
					<legend>Add a file</legend>
					<input id="filename" type="file" name="gfile" />
					<input type="submit" value="aggiungi file" />
				</fieldset>
			</div>
		</form>
		<div id="fileprogress" style="font-weight: bold;"> </div>
		<pre><?php var_dump($_FILES); ?></pre>


<?php
$uploaddir = '/home/content/m/i/k/mikewolf/html/test/up1/tmp/';
$uploadfile = $uploaddir . basename($_FILES['gfile']['name']);
echo $uploadfile;
if (move_uploaded_file($_FILES['gfile']['tmp_name'], $uploadfile)) {
        echo  $_FILES['userfile']['tmp_name'] .  "\n";
    echo "File is valid, and was successfully uploaded.\n";
} else {
       echo "_file:" . $_FILES['userfile']['tmp_name'] .  "\n";
echo "#uploadfile:" . $uploadfile . "\n";
    echo "Possible file upload attack!\n";
}


print_r("\n");
print_r($_FILES);

?>

	</body>
</html>
